package com.lianbang.staff.module.main

import android.app.Activity
import android.content.Context
import android.content.Intent
import cn.ubest.mvvmcore.base.BaseListActivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.lianbang.staff.R
import com.lianbang.staff.adapter.ShopListAdapter
import com.lianbang.staff.bean.ShopListBean
import com.lianbang.staff.databinding.ActivityShopSearchBinding
import com.lianbang.staff.vm.MainVM
import kotlinx.android.synthetic.main.activity_shop_search.*

/**
 * Created by maoqi on 2021/1/13.
 */
class SearchActivity : BaseListActivity<MainVM, ActivityShopSearchBinding, ShopListBean>() {

    companion object{
        @JvmStatic
        fun start(context: Context?) {
            context?.also {
                val starter = Intent(it, SearchActivity::class.java)
                if (it !is Activity) {
                    starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                }
                it.startActivity(starter)
            }
        }
    }

    override fun initAdapter(): BaseQuickAdapter<ShopListBean, *> {
        return ShopListAdapter()
    }

    override fun initLayout(): Int {
        return R.layout.activity_shop_search
    }

    override fun initView() {
        super.initView()
        btn_back.setOnClickListener {
            finish()
        }
        btn_search.setOnClickListener {
            mViewModel.refreshData()
        }
    }

    override fun loadData() {
    }

}